#include"yu.h"
#include"jiajia_lmcc.h"

int main(int argc, char *argv[]){
    if(argc != 2){
        printf("使用: ./main <jiajia file path>\n", argv[1]);
        return 1;
    }

    int32_t stat = JiaJia_file_open(argv[1]);
    switch(stat){
    case JiaJia_FILE_OPEN_FAIL:
        Yu_exit(0, "文件 %s，无法打开\n", argv[1]);
        break;
    case JiaJia_FILE_OPEN_NOEXIT:
        Yu_exit(0, "文件 %s，不存在或损坏无法打开\n", argv[1]);
        break;
    case JiaJia_FILE_OPEN_NOTYPE:
        Yu_exit(0, "文件 %s，后缀非 .jiajia\n", argv[1]);
        break;
    }

    unicode_t c32 = YU_UNICODE_EOF;
    while((c32 = JiaJia_next_unicode()) != YU_UNICODE_EOF){
        Yu_print_fmt("%c", c32);
    }

    return 0;
}
